home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr49 / 273_01.zip / SWRITEA.CA < prev    next >
Text File  |  1993-04-04  |  1KB  |  44 lines

  1. #include <dos.h>
  2. swrite_a(int row, int col, int attr)
  3. /* This will write the attribute attr at row,col
  4. */
  5. {
  6.   extern int color, mono, cga, ega, scrseg, bios;
  7.   union REGS inregs, outregs;
  8.   int   scrofs, *pattr, orow, ocol ,x;
  9.   char pchar;
  10.   char far *base;
  11.   char far *work;
  12.     if(mono) base=(char far *)0xb0000000;
  13.     else base=(char far *)0xb8000000;
  14.     if(bios) {
  15.         locate(row,col) ;
  16.         inregs.h.bh=0x00;
  17.         inregs.h.ah=0x08;
  18.         int86(0x10,&inregs,&outregs);
  19.         inregs.h.bl=attr;
  20.         inregs.h.bh=0x00;
  21.         inregs.h.ah=0x09;
  22.         inregs.x.cx=0x01;
  23.         inregs.h.al=outregs.h.al;
  24.         int86(0x10,&inregs,&outregs);
  25.         return(0);
  26.     }
  27.     scrofs = ((((row+1) * 160) - 160) + ((col+1) * 2)) - 2;
  28.     work = base + scrofs + 1;
  29.     pchar = attr;
  30.     asm les bx,work
  31.     asm mov cl,pchar
  32.     if(cga) {
  33.             asm     mov    dx,03dah
  34.             asm        in    al,dx
  35.             asm        test al,1
  36.             asm        jnz $-3
  37.             asm        in    al,dx
  38.             asm        test al,1
  39.             asm        jz $-3
  40.         }
  41.     asm mov byte ptr es:[bx],cl
  42.     return(0);
  43. }
  44.